/**
 * 
 */
package ch.comtools.servermanager.ssh.ui.wizard;

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;

import ch.comtools.servermanager.ssh.ui.wizard.page.NewSecureShellConnectionWizardPage;

/**
 * @author axrdu01
 *
 */
public class SecureShellConnectionWizard extends Wizard implements INewWizard {

	private NewSecureShellConnectionWizardPage connectionPage;

	/* (non-Javadoc)
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
	 */
	@Override
	public boolean performFinish() {
		System.out.println("Password: " + this.connectionPage.getPassword());
		if (this.connectionPage.getHost() != null &&
			this.connectionPage.getUser() != null) {
			return true;
		}
		return false;
	}
	
	@Override
	public void addPages() {
		connectionPage = new NewSecureShellConnectionWizardPage("New SSH Terminal");
		this.addPage(connectionPage);
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
	 */
	public void init(IWorkbench workbench, IStructuredSelection selection) {
		this.setWindowTitle("New SSH Terminal");
		this.setNeedsProgressMonitor(true);
	}
	
	/**
	 * @return
	 */
	public String getHost() {
		return this.connectionPage.getHost();
	}
	
	/**
	 * @return
	 */
	public String getUser() {
		return this.connectionPage.getUser();
	}
	
	/**
	 * @return
	 */
	public String getLabel() {
		return this.connectionPage.getLabel();
	}
	
	/**
	 * @return
	 */
	public String getPassword() {
		return this.connectionPage.getPassword();
	}
	
	/**
	 * @return
	 */
	public int getPort() {
		return this.connectionPage.getPort();
	}

}
